package com.xqb.modules.service.impl;

import com.xqb.common.utils.DateUtils;
import com.xqb.modules.domain.po.OrdOrderDetail;
import com.xqb.modules.mapper.OrdOrderDetailMapper;
import com.xqb.modules.service.IOrdOrderDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 订单明细Service业务层处理
 * 
 * @author xqb
 * @date 2024-10-14
 */
@Service
public class OrdOrderDetailServiceImpl implements IOrdOrderDetailService 
{
    @Autowired
    private OrdOrderDetailMapper ordOrderDetailMapper;

    /**
     * 查询订单明细
     * 
     * @param id 订单明细主键
     * @return 订单明细
     */
    @Override
    public OrdOrderDetail selectOrdOrderDetailById(Long id)
    {
        return ordOrderDetailMapper.selectOrdOrderDetailById(id);
    }

    /**
     * 查询订单明细列表
     * 
     * @param ordOrderDetail 订单明细
     * @return 订单明细
     */
    @Override
    public List<OrdOrderDetail> selectOrdOrderDetailList(OrdOrderDetail ordOrderDetail)
    {
        return ordOrderDetailMapper.selectOrdOrderDetailList(ordOrderDetail);
    }

    /**
     * 新增订单明细
     * 
     * @param ordOrderDetail 订单明细
     * @return 结果
     */
    @Override
    public int insertOrdOrderDetail(OrdOrderDetail ordOrderDetail)
    {
        ordOrderDetail.setCreateTime(DateUtils.getNowDate());
        return ordOrderDetailMapper.insertOrdOrderDetail(ordOrderDetail);
    }

    /**
     * 修改订单明细
     * 
     * @param ordOrderDetail 订单明细
     * @return 结果
     */
    @Override
    public int updateOrdOrderDetail(OrdOrderDetail ordOrderDetail)
    {
        ordOrderDetail.setUpdateTime(DateUtils.getNowDate());
        return ordOrderDetailMapper.updateOrdOrderDetail(ordOrderDetail);
    }

    /**
     * 批量删除订单明细
     * 
     * @param ids 需要删除的订单明细主键
     * @return 结果
     */
    @Override
    public int deleteOrdOrderDetailByIds(Long[] ids)
    {
        return ordOrderDetailMapper.deleteOrdOrderDetailByIds(ids);
    }

    /**
     * 删除订单明细信息
     * 
     * @param id 订单明细主键
     * @return 结果
     */
    @Override
    public int deleteOrdOrderDetailById(Long id)
    {
        return ordOrderDetailMapper.deleteOrdOrderDetailById(id);
    }
}
